<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
use yii\helpers\Url;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>{:L('LOGIN_TITLE')}</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content=""/>
<meta name="author" content="{:L('AUTHOR')}"/>
<?=Html::cssFile('@web/static/src/layui/css/layui.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<?=Html::cssFile('@web/Public/css/bootstrap.min.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<?=Html::cssFile('@web/Public/css/bootstrap-responsive.min.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<?=Html::cssFile('@web/Public/css/jquery-ui-1.10.0.custom.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<?=Html::cssFile('@web/Public/css/font-awesome.min.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<?=Html::cssFile('@web/Public/css/docs.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<script type="text/javascript">
    var browserInfo = {browser:"", version: ""};
    var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject) {
        browserInfo.browser = "IE";
        browserInfo.version = ua.match(/msie ([\d.]+)/)[1];
        if(browserInfo.version <= 7){
            if(confirm("您的ie浏览器版本过低，建议使用chorme浏览器，\n点击【确定】转到下载页面")){}
            location.href = 'http://www.google.cn/intl/zh-CN/chrome/browser/';
        }
    }
</script>
<?=Html::jsFile('@web/Public/js/jquery-1.9.0.min.js', ['type' => "text/javascript"])?>
<?=Html::jsFile('@web/Public/js/bootstrap.min.js', ['type' => "text/javascript"])?>
<?=Html::jsFile('@web/Public/js/jquery-ui-1.10.0.custom.min.js', ['type' => "text/javascript"])?>
<?=Html::jsFile('@web/Public/js/WdatePicker.js', ['type' => "text/javascript"])?>
<?=Html::jsFile('@web/Public/js/5kcrm.js', ['type' => "text/javascript"])?>
<!--[if lte IE 6]>
<?=Html::cssFile('@web/Public/css/bootstrap-ie6.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<![endif]-->
<!--[if lte IE 7]>
<?=Html::cssFile('@web/Public/css/ie.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<![endif]-->
<!--[if IE 7]>
<?=Html::cssFile('@web/Public/css/font-awesome-ie7.min.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<![endif]-->
<!--[if lt IE 9]>
<?=Html::cssFile('@web/Public/css/jquery.ui.1.10.0.ie.css', ['rel' => "stylesheet", 'type' => 'text/css'])?>
<![endif]-->
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<?=Html::jsFile('@web/Public/js/respond.min.js', ['type' => "text/javascript"])?>
<![endif]-->

<style type="text/css">
    body {
        padding-top: 60px;
        padding-bottom: 40px;
        background-color: #f5f5f5;
    }
    .form-signin {
        max-width: 400px;
        padding: 19px 29px 29px;
        margin: 0 auto 20px;
        background-color: #fff;
    }
    .form-signin .form-signin-heading,
    .form-signin .checkbox {
        margin-bottom: 10px;
    }
    .form-signin input[type="text"],
    .form-signin input[type="password"] {
        font-size: 16px;
        height: auto;
        margin-bottom: 15px;
        padding: 7px 9px;
    }
    .wukong {
        margin-top:30px;
        padding-top:10px;
        border-top:1px solid #e5e5e5;
    }
    .logo{
        width:50px;
        height:50px;
    }
</style>
<?=Html::jsFile('@web/static/src/layui/layui.js', ['type' => "text/javascript"])?>
</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar" data-twttr-rendered="true">
<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <div style="line-height: 40px;padding-right: 5px;padding-top: 6px;" class="pull-left">
                <?= Html::img("@web/Public/img/etcp_logo.png");?>
            </div>
        </div>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="span8">
            <h4><?= Html::img("@web/Public/img/index_notice.png",['style'=>'width:17.5px;']);?>系统公告</h4>
            <div class="hero-unit">
                <!--<volist name="announcement_list" id="vo" key="k">
                    <p>{$k}、
                        <a onclick="javascript:show({$vo['announcement_id']});" style="font-size: 14px;color:#{$vo.color}">{$vo.title}</a>
                        <if condition="(time()-$vo['update_time']) lt 86400*7"> &nbsp;
                            <?= Html::img("@web/Public/img/new.gif");?>
                            <img src="./Public/img/new.gif">
                        </if> &nbsp; ({:L('UPDATE_DATE')}：{$vo.update_time|date="Y-m-d H:i",###})
                    </p>
                    <div id="content{$vo['announcement_id']}" class="hide">{$vo.content}</div>
                </volist>-->
            </div>
            <div id="pageDemo"></div>
        </div>
        <div class="span4">
            <div style="border-left:1px solid #eee;">
                <form action="" method="post" class="form-signin">
                    <fieldset>
                        <legend><h3>用户登录</h3></legend>
                        <include file="Public:alert" />
                        用户名：<input type="text" name="name" class="text-input" placeholder="用户名"/><br/>
                        密  码：<input type="password" name="password" class="text-input" placeholder="密码"/>
                        <br/>
                        <!--			<label class="checkbox"><input type="checkbox" name="autologin"/> {:L('AUTO_LOGIN_IN_THREE_DAYS')}</label>-->
                        <input name="submit" class="btn btn-primary" type="submit" value="登录"/> &nbsp;
                        <!--                        <a href="{:U('user/lostpw')}">{:L('FORGET_PASSWORD')}</a>-->
                    </fieldset>
                    <div class="row-fluid wukong">
                        <div class="span9">
                            <p>ETCPCRM © 北京悦畅科技有限公司 2016-2020</p>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<div id="dialog-message" class="hide" title="公告">loading...</div>
<script type="text/javascript">
$('#dialog-message').dialog({
    autoOpen: false,
    modal: true,
    width: 600,
    maxHeight: 400,
    position :["center",100]
});
function show(id) {
    $('#dialog-message').dialog('open');
    content = $("#content" + id).html();
    $('#dialog-message').html(content);
}


layui.use(['layer', 'laypage', 'element'], function(){
    var pages=0;
    var layer = layui.layer
        ,laypage = layui.laypage
        ,element = layui.element();
    showPage(layer, laypage, 1);
});
function showPage(layer, laypage, curr){
    $.ajax({
        type: 'POST',
        data: "p="+curr,
        url: "<?= Url::to("/common/announcement/get-show-list")?>",
        dataType: 'json',
        success: function(ret){
            if(ret.code == 0) {
                pages = ret.total;
                var html = '';
                $.each( ret.data, function(index, content)
                {
                    html+="<p>"+(index+1)+"、<a onclick=\"javascript:show("+content.announcement_id+");\" style=\"font-size: 14px;color:#\">"+content.title
                    +"<\/a>&nbsp;&nbsp;(更新时间："+new Date(parseInt(content.update_time) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ')+") <\/p>"
                    +"<div id=\"content"+content.announcement_id
                    +"\" class=\"hide\">"+content.content
                    +"<\/div>";
                });
                $(".hero-unit").html(html);
                //分页
                laypage({
                    cont: 'pageDemo' //分页容器的id
//                    ,first: curr
                    ,groups: 5 //连续显示分页数
                    ,curr: curr//当前第几页
                    ,pages: pages //总页数
                    ,skin: '#5FB878' //自定义选中色值
                    ,skip: true //开启跳页
                    ,jump: function(obj, first){
                        if(!first){
                            showPage(layer, laypage, obj.curr);
                        }
                    }
                });
            }
            layer.close(index);
        },
        error: function(xhr){
            layer.msg('公告数据请求异常');
        }
    });
}
</script>
</body>